package com.jgsu.sell.converter;

import com.jgsu.sell.dataobject.OrderMaster;
import com.jgsu.sell.dto.OrderDto;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 描述:
 * 转化器
 *
 * @author lqd12
 * @create 2018-08-19 0:53
 */
public class OrderMaster2OrderDtoConverter {

    public static OrderDto convert(OrderMaster orderMaster){
        OrderDto orderDto = new OrderDto();
        BeanUtils.copyProperties(orderMaster,orderDto);
        return orderDto;
    }

    public static List<OrderDto> convertList(List<OrderMaster> orderMasterList){
        return  orderMasterList.stream().map(e -> convert(e)
        ).collect(Collectors.toList());
    }
}